package javaeSE.json;


public class Test {
    public static void main(String[] args) {

        //将字符串转换为json对象，然后根据建得到相应的值
        ParseJson pj = new ParseJson("{\"name\":\"gu\",\"num\":123456,\"sex\":\"male\",\"age\":24}");
        pj.parse();

        //将一个json字符串转换为java对象
        Person p = pj.JSON2Object();
        System.out.println("Name:" + p.getName());
        System.out.println("Num:" + p.getNum());
        System.out.println("Sex:" + p.getSex());
        System.out.println("age:" + p.getAge());

        //将一个java对象转换为Json字符串
        Person p1 = new Person("gu1",123,"male",23);
        ConsJson cj = new ConsJson();
        String str1 = cj.Object2Json(p1);
        System.out.println(str1);

    }

}